package org.example.c2;

import lombok.extern.slf4j.Slf4j;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author liu-rui
 * @date 2020/6/8 下午2:12
 * @description
 * @since
 */
@Slf4j
public class Demo31 {
    public static void main(String[] args) {
        ThreadLocal<SimpleDateFormat> simpleDateFormat = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd"));

        for (int i = 0; i < 100; i++) {
            new Thread(() -> {
                final Date parse;
                try {
                    parse = simpleDateFormat.get().parse("2020-11-10");

                    log.info("{}", parse);
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            }).start();
        }
    }
}
